package com.wzg.jetpack_blackbox.login.room.Converter;

import androidx.room.TypeConverter;

import com.blankj.utilcode.util.GsonUtils;
import com.google.gson.reflect.TypeToken;

import java.util.List;

/**
 * 万能转换器
 */
public class BaseListConverter<T> {


    @TypeConverter
    public List<T> stringToObject(String any) {
        return GsonUtils.fromJson(any, new TypeToken<List<T>>() {
        }.getType());
    }


    @TypeConverter
    public String objectToString(List<T> any) {
        return GsonUtils.toJson(any);
    }



}
